#!/usr/bin/python
import os
import sys
from subprocess import call

def ncd(x, y):
    return float(C(x,y) - min(os.path.getsize(x+".mpg"), os.path.getsize(y+".mpg"))) / max(os.path.getsize(x+".mpg"), os.path.getsize(y+".mpg"))

def C(fname1, fname2):
    return os.path.getsize(fname1+"_"+fname2+".mpg")

def ncd2(x, y):
    return (float(C(x,y) + C(y,x))/float(C(x,x) + C(y,y))) - 1

basenames = [os.path.splitext(i)[0] for i in sys.argv[1:]]
while len(basenames) > 1:
#    if ncd2(basenames[0], basenames[1]) > .2:
#        print basenames[0]
    print basenames[0]+'\t'+'%.3f' % ncd2(basenames[0], basenames[1])
    basenames = basenames[1:]
